import 'normalize.css'
import 'nprogress/nprogress.css'

import { ElMessage, ElMessageBox } from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'

import '@/assets/style/element.scss'
import '@/assets/style/jaguar.scss'

import 'virtual:svg-icons-register'
import IconSvg from './IconSvg.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import ThemeSwitcher from './ThemeSwitcher/index.vue'

import mitt from 'mitt'

// 加载全局组件
export function loadComponents(app) {
  app.use(ElMessage, { zhCn })
  app.use(ElMessageBox, { zhCn })

  app.component('icon-svg', IconSvg)
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }

  app.component('theme-switcher', ThemeSwitcher)

  app.config.globalProperties.$bus = new mitt()
}
